package com.security.config;

import com.security.interceptor.InterfaceAuthCheckInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Package: com.security.config
 * Description：
 * Author: huangjian
 * Date:  2020/9/17 10:19
 * Modified By:
 */
@Configuration
public class InterceptorConfig extends WebMvcConfigurerAdapter {

    @Bean
    public InterfaceAuthCheckInterceptor getInterfaceAuthCheckInterceptor() {
        return new InterfaceAuthCheckInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getInterfaceAuthCheckInterceptor()).addPathPatterns("/open/**");
        super.addInterceptors(registry);
    }
}